package top.songxs.gmall.product.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.songxs.gmall.common.result.Result;
import top.songxs.gmall.common.result.ResultCodeEnum;
import top.songxs.gmall.product.entity.BaseCategory2;
import top.songxs.gmall.product.service.BaseCategory2Service;

import java.util.List;

@RestController
@RequestMapping("admin/product")
public class BaseCategory2Controller {
    @Autowired
    private BaseCategory2Service baseCategory2Service;

    @GetMapping("getCategory2/{category1Id}")
    public Result<List<BaseCategory2>> findAllBaseCategory2ByC1Id(@PathVariable(value = "category1Id") Long c1Id){
        List<BaseCategory2> lists = baseCategory2Service.findAllBaseCategory2ByC1Id(c1Id);
        return Result.build(lists, ResultCodeEnum.SUCCESS);
    }
}
